<?xml version="1.0"?>
<jsp:root 	xmlns:jsp="http://java.sun.com/JSP/Page"
 			xmlns:c="http://java.sun.com/jsp/jstl/core"
 			xmlns="http://www.w3.org/1999/xhtml"
 			version="2.1">
 
 <jsp:directive.page contentType="text/html" pageEncoding="UTF-8" />
 <jsp:directive.page isELIgnored="false" />
 <jsp:output 	omit-xml-declaration="false" 
 			 	doctype-root-element="HTML" 
 				doctype-system="about:legacy-compat" />
 
 <jsp:useBean id="datosLogin" class="es.javamyadmin.beans.LoginBean" scope="session" />
 
 <jsp:useBean id="listaUsuariosBean" class="es.javamyadmin.beans.ListaUsuariosBean" scope="session" />
 <jsp:setProperty property="user" name="listaUsuariosBean" value="${datosLogin.usuario}" />
 <jsp:setProperty property="pass" name="listaUsuariosBean" value="${datosLogin.password}" />
 <jsp:setProperty property="host" name="listaUsuariosBean" value="${datosLogin.servidor}" />
 <jsp:setProperty property="port" name="listaUsuariosBean" value="${datosLogin.puerto}" />
 <jsp:setProperty property="clausulaWhere" name="listaUsuariosBean" value="WHERE User ='${param.usuarioSQL}' AND Host ='${param.hostSQL}'" />

<html>
<head>

<link rel="icon" href="${pageContext.request.contextPath}/images/favicon.ico" type="image/x-icon"/>
<link rel="shortcut icon" href="${pageContext.request.contextPath}/images/favicon.ico" type="image/x-icon" />

<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/reset.css" media="screen" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/java-admin.css" media="screen" />

<title>JavaMyAdmin</title>

</head>

<body>

<div id="contenedor">
	
	<jsp:include page="../includes/sidebar-left.jsp" />
	
	<div id="contenido">
	
		<jsp:include page="../includes/cabecera.jsp" />
		
		<c:forEach var="lista" items="${listaUsuariosBean.usuarios}">
		
			<img style="float: left; margin-right: 5px;" src="${pageContext.request.contextPath}/images/icons/user.png"/><h2>${lista.user}</h2>
			
			<div style="clear: both;"></div>
		
			<fieldset id="privilegios">
				<legend>Privilegios Globales</legend>
				
				<fieldset id="datos">
					<legend>Datos</legend>
					
					<table>
						<tr>
							<td>
								<c:choose>
									<c:when test="${lista.select_priv=='Y'}">
										<input type="checkbox" name="select_priv" checked="checked" disabled="disabled" id="select_priv" value="SELECT"/>
									</c:when>
									<c:otherwise>
										<input type="checkbox" name="select_priv" disabled="disabled" id="select_priv" value="SELECT"/>
									</c:otherwise>
								</c:choose>								
							</td>
							<td>
								<label for="select_priv">
									<tt>
										<dfn title="Permite leer los datos.">SELECT</dfn>
									</tt>
								</label>
							</td>
						</tr>
						
						<tr>
							<td>
								<c:choose>
									<c:when test="${lista.insert_priv=='Y'}">
										<input type="checkbox" name="insert_priv" checked="checked" disabled="disabled" id="insert_priv" value="SI"/>
									</c:when>
									<c:otherwise>
										<input type="checkbox" name="insert_priv" disabled="disabled" id="insert_priv" value="SI"/>
									</c:otherwise>
								</c:choose>
							</td>
							<td>
								<label for="insert_priv">
									<tt>
										<dfn title="Permite insertar y reemplazar datos.">INSERT</dfn>
									</tt>
								</label>
							</td>
						</tr>
						
						<tr>
							<td>
								<c:choose>
									<c:when test="${lista.update_priv=='Y'}">
										<input type="checkbox" name="update_priv" checked="checked" disabled="disabled" id="update_priv" value="SI"/>
									</c:when>
									<c:otherwise>
										<input type="checkbox" name="update_priv" disabled="disabled" id="update_priv" value="SI"/>
									</c:otherwise>
								</c:choose>
							</td>
							<td>
								<label for="update_priv">
									<tt>
										<dfn title="Permite cambiar los datos.">UPDATE</dfn>
									</tt>
								</label>
							</td>
						</tr>
						
						<tr>
							<td>
								<c:choose>
									<c:when test="${lista.delete_priv=='Y'}">
										<input type="checkbox" name="delete_priv" checked="checked" disabled="disabled" id="delete_priv" value="SI"/>
									</c:when>
									<c:otherwise>
										<input type="checkbox" name="delete_priv" disabled="disabled" id="delete_priv" value="SI"/>
									</c:otherwise>
								</c:choose>
							</td>
							<td>
								<label for="delete_priv">
									<tt>
										<dfn title="Permite borrar datos.">DELETE</dfn>
									</tt>
								</label>
							</td>
						</tr>
						
						<tr>
							<td>
								<c:choose>
									<c:when test="${lista.file_priv=='Y'}">
										<input type="checkbox" name="file_priv" checked="checked" disabled="disabled" id="file_priv" value="SI"/>
									</c:when>
									<c:otherwise>
										<input type="checkbox" name="file_priv" disabled="disabled" id="file_priv" value="SI"/>
									</c:otherwise>
								</c:choose>
							
							</td>
							<td>
								<label for="file_priv">
									<tt>
										<dfn title="Permite importar y exportar datos de y hacia archivos.">FILE</dfn>
									</tt>
								</label>
							</td>
						</tr>
						
					</table>
										
				</fieldset>
				
				<fieldset id="estructura">
					<legend>Estructura</legend>
					
					<table>
						<tr>
							<td>
								<c:choose>
									<c:when test="${lista.create_priv=='Y'}">
										<input type="checkbox" name="create_priv" checked="checked" disabled="disabled" id="create_priv" value="SI"/>
									</c:when>
									<c:otherwise>
										<input type="checkbox" name="create_priv" disabled="disabled" id="create_priv" value="SI"/>
									</c:otherwise>
								</c:choose>
							</td>
							<td>
								<label for="create_priv">
									<tt>
										<dfn title="Permite crear nuevas bases de datos y tablas.">CREATE</dfn>
									</tt>
								</label>
							</td>
						</tr>
						
						<tr>
							<td>
								<c:choose>
									<c:when test="${lista.alter_priv=='Y'}">
										<input type="checkbox" name="alter_priv" checked="checked" disabled="disabled" id="alter_priv" value="SI"/>
									</c:when>
									<c:otherwise>
										<input type="checkbox" name="alter_priv" disabled="disabled" id="alter_priv" value="SI"/>
									</c:otherwise>
								</c:choose>
							</td>
							<td>
								<label for="alter_priv">
									<tt>
										<dfn title="Permite alterar la estructura de las tablas existentes.">ALTER</dfn>
									</tt>
								</label>
							</td>
						</tr>
						
						<tr>
							<td>
								<c:choose>
									<c:when test="${lista.index_priv=='Y'}">
										<input type="checkbox" name="index_priv" checked="checked" disabled="disabled" id="index_priv" value="SI"/>
									</c:when>
									<c:otherwise>
										<input type="checkbox" name="index_priv" disabled="disabled" id="index_priv" value="SI"/>
									</c:otherwise>
								</c:choose>							
							</td>
							<td>
								<label for="index_priv">
									<tt>
										<dfn title="Permite crear y eliminar índices.">INDEX</dfn>
									</tt>
								</label>
							</td>
						</tr>
						
						<tr>
							<td>
								<c:choose>
									<c:when test="${lista.drop_priv=='Y'}">
										<input type="checkbox" name="drop_priv" checked="checked" disabled="disabled" id="drop_priv" value="SI"/>
									</c:when>
									<c:otherwise>
										<input type="checkbox" name="drop_priv" disabled="disabled" id="drop_priv" value="SI"/>
									</c:otherwise>
								</c:choose>								
							</td>
							<td>
								<label for="drop_priv">
									<tt>
										<dfn title="Permite eliminar bases de datos y tablas.">DROP</dfn>
									</tt>
								</label>
							</td>
						</tr>
						
						<tr>
							<td>
								<c:choose>
									<c:when test="${lista.create_tmp_table_priv=='Y'}">
										<input type="checkbox" name="create_tmp_table_priv" checked="checked" disabled="disabled" id="create_tmp_table_priv" value="SI"/>
									</c:when>
									<c:otherwise>
										<input type="checkbox" name="create_tmp_table_priv" disabled="disabled" id="create_tmp_table_priv" value="SI"/>
									</c:otherwise>
								</c:choose>	
							</td>
							<td>
								<label for="create_tmp_table_priv">
									<tt>
										<dfn title="Permite la creación de tablas temporales.">CREATE TEMPORARY TABLES</dfn>
									</tt>
								</label>
							</td>
						</tr>
						
						<tr>
							<td>
								<c:choose>
									<c:when test="${lista.show_view_priv=='Y'}">
										<input type="checkbox" name="show_view_priv" checked="checked" disabled="disabled" id="show_view_priv" value="SI"/>
									</c:when>
									<c:otherwise>
										<input type="checkbox" name="show_view_priv" disabled="disabled" id="show_view_priv" value="SI"/>
									</c:otherwise>
								</c:choose>	
							</td>
							<td>
								<label for="show_view_priv">
									<tt>
										<dfn title="Permite llevar a cabo las consultas SHOW CREATE VIEW.">SHOW VIEW</dfn>
									</tt>
								</label>
							</td>
						</tr>
						
						<tr>
							<td>
								<c:choose>
									<c:when test="${lista.create_routine_priv=='Y'}">
										<input type="checkbox" name="create_routine_priv" checked="checked" disabled="disabled" id="create_routine_priv" value="SI"/>
									</c:when>
									<c:otherwise>
										<input type="checkbox" name="create_routine_priv" disabled="disabled" id="create_routine_priv" value="SI"/>
									</c:otherwise>
								</c:choose>	
							</td>
							<td>
								<label for="create_routine_priv">
									<tt>
										<dfn title="Permite crear el almacenamiento de rutinas.">CREATE ROUTINE</dfn>
									</tt>
								</label>
							</td>
						</tr>
						
						<tr>
							<td>
								<c:choose>
									<c:when test="${lista.alter_routine_priv=='Y'}">
										<input type="checkbox" name="alter_routine_priv" checked="checked" disabled="disabled" id="alter_routine_priv" value="SI"/>
									</c:when>
									<c:otherwise>
										<input type="checkbox" name="alter_routine_priv" disabled="disabled" id="alter_routine_priv" value="SI"/>
									</c:otherwise>
								</c:choose>
							</td>
							<td>
								<label for="alter_routine_priv">
									<tt>
										<dfn title="Permite alterar y eliminar las rutinas almacenadas.">ALTER ROUTINE</dfn>
									</tt>
								</label>
							</td>
						</tr>
						
						<tr>
							<td>
								<c:choose>
									<c:when test="${lista.execute_priv=='Y'}">
										<input type="checkbox" name="execute_priv" checked="checked" disabled="disabled" id="execute_priv" value="SI"/>
									</c:when>
									<c:otherwise>
										<input type="checkbox" name="execute_priv" disabled="disabled" id="execute_priv" value="SI"/>
									</c:otherwise>
								</c:choose>
							</td>
							<td>
								<label for="execute_priv">
									<tt>
										<dfn title="Permite ejecutar las rutinas almacenadas.">EXECUTE</dfn>
									</tt>
								</label>
							</td>
						</tr>
						
						<tr>
							<td>
								<c:choose>
									<c:when test="${lista.create_view_priv=='Y'}">
										<input type="checkbox" name="create_view_priv" checked="checked" disabled="disabled" id="create_view_priv" value="SI"/>
									</c:when>
									<c:otherwise>
										<input type="checkbox" name="create_view_priv" disabled="disabled" id="create_view_priv" value="SI"/>
									</c:otherwise>
								</c:choose>
							</td>
							<td>
								<label for="create_view_priv">
									<tt>
										<dfn title="Permite crear nuevas vistas.">CREATE VIEW</dfn>
									</tt>
								</label>
							</td>
						</tr>
						
						<tr>
							<td>
								<c:choose>
									<c:when test="${lista.event_priv=='Y'}">
										<input type="checkbox" name="event_priv" checked="checked" disabled="disabled" id="event_priv" value="SI"/>
									</c:when>
									<c:otherwise>
										<input type="checkbox" name="event_priv" disabled="disabled" id="event_priv" value="SI"/>
									</c:otherwise>
								</c:choose>
							</td>
							<td>
								<label for="event_priv">
									<tt>
										<dfn title="Permite organizar los eventos para el gestor de eventos">EVENT</dfn>
									</tt>
								</label>
							</td>
						</tr>
						
						<tr>
							<td>
								<c:choose>
									<c:when test="${lista.trigger_priv=='Y'}">
										<input type="checkbox" name="trigger_priv" checked="checked" disabled="disabled" id="trigger_priv" value="SI"/>
									</c:when>
									<c:otherwise>
										<input type="checkbox" name="trigger_priv" disabled="disabled" id="trigger_priv" value="SI"/>
									</c:otherwise>
								</c:choose>
							</td>
							<td>
								<label for="trigger_priv">
									<tt>
										<dfn title="Permite crear y eliminar un disparador">TRIGGER</dfn>
									</tt>
								</label>
							</td>
						</tr>
						
					</table>
					
				</fieldset>
				
				<fieldset id="administracion">
					<legend>Administración</legend>
					
					<table>
						<tr>
							<td>
								<c:choose>
									<c:when test="${lista.grant_priv=='Y'}">
										<input type="checkbox" name="grant_priv" checked="checked" disabled="disabled" id="grant_priv" value="SI"/>
									</c:when>
									<c:otherwise>
										<input type="checkbox" name="grant_priv" disabled="disabled" id="grant_priv" value="SI"/>
									</c:otherwise>
								</c:choose>
							</td>
							<td>
								<label for="grant_priv">
									<tt>
										<dfn title="Permite añadir usuarios y privilegios sin conectarse nuevamente a la tabla de privilegios.">GRANT</dfn>
									</tt>
								</label>
							</td>
						</tr>
						
						<tr>
							<td>
								<c:choose>
									<c:when test="${lista.super_priv=='Y'}">
										<input type="checkbox" name="super_priv" checked="checked" disabled="disabled" id="super_priv" value="SI"/>
									</c:when>
									<c:otherwise>
										<input type="checkbox" name="super_priv" disabled="disabled" id="super_priv" value="SI"/>
									</c:otherwise>
								</c:choose>
							</td>
							<td>
								<label for="super_priv">
									<tt>
										<dfn title="Permite la conexión, incluso si el número máximo de conexiones ha sido alcanzado; Necesario para la mayor parte de operaciones administrativas tales como montar parámetros de variables globales o matar procesos de otros usuarios.">SUPER</dfn>
									</tt>
								</label>
							</td>
						</tr>
						
						<tr>
							<td>
								<c:choose>
									<c:when test="${lista.process_priv=='Y'}">
										<input type="checkbox" name="process_priv" checked="checked" disabled="disabled" id="process_priv" value="SI"/>
									</c:when>
									<c:otherwise>
										<input type="checkbox" name="process_priv" disabled="disabled" id="process_priv" value="SI"/>
									</c:otherwise>
								</c:choose>
							</td>
							<td>
								<label for="process_priv">
									<tt>
										<dfn title="Permite ver los procesos de todos los usuarios">PROCESS</dfn>
									</tt>
								</label>
							</td>
						</tr>
						
						<tr>
							<td>
								<c:choose>
									<c:when test="${lista.reload_priv=='Y'}">
										<input type="checkbox" name="reload_priv" checked="checked" disabled="disabled" id="reload_priv" value="SI"/>
									</c:when>
									<c:otherwise>
										<input type="checkbox" name="reload_priv" disabled="disabled" id="reload_priv" value="SI"/>
									</c:otherwise>
								</c:choose>
							</td>
							<td>
								<label for="reload_priv">
									<tt>
										<dfn title="Permite volver a cargar los parámetros del servidor y depurar los cachés del servidor.">RELOAD</dfn>
									</tt>
								</label>
							</td>
						</tr>
						
						<tr>
							<td>
								<c:choose>
									<c:when test="${lista.shutdown_priv=='Y'}">
										<input type="checkbox" name="shutdown_priv" checked="checked" disabled="disabled" id="shutdown_priv" value="SI"/>
									</c:when>
									<c:otherwise>
										<input type="checkbox" name="shutdown_priv" disabled="disabled" id="shutdown_priv" value="SI"/>
									</c:otherwise>
								</c:choose>
							</td>
							<td>
								<label for="shutdown_priv">
									<tt>
										<dfn title="Permite desconectar el servidor.">SHUTDOWN</dfn>
									</tt>
								</label>
							</td>
						</tr>
						
						<tr>
							<td>
								<c:choose>
									<c:when test="${lista.show_db_priv=='Y'}">
										<input type="checkbox" name="show_db_priv" checked="checked" disabled="disabled" id="show_db_priv" value="SI"/>
									</c:when>
									<c:otherwise>
										<input type="checkbox" name="show_db_priv" disabled="disabled" id="show_db_priv" value="SI"/>
									</c:otherwise>
								</c:choose>
							</td>
							<td>
								<label for="show_db_priv">
									<tt>
										<dfn title="Concede acceso a la lista completa de bases de datos.">SHOW DATABASES</dfn>
									</tt>
								</label>
							</td>
						</tr>
						
						<tr>
							<td>
								<c:choose>
									<c:when test="${lista.lock_tables_priv=='Y'}">
										<input type="checkbox" name="lock_tables_priv" checked="checked" disabled="disabled" id="lock_tables_priv" value="SI"/>
									</c:when>
									<c:otherwise>
										<input type="checkbox" name="lock_tables_priv" disabled="disabled" id="lock_tables_priv" value="SI"/>
									</c:otherwise>
								</c:choose>
							</td>
							<td>
								<label for="lock_tables_priv">
									<tt>
										<dfn title="Permite poner candados a las tablas para el proceso actual.">LOCK TABLES</dfn>
									</tt>
								</label>
							</td>
						</tr>
						
						<tr>
							<td>
								<c:choose>
									<c:when test="${lista.references_priv=='Y'}">
										<input type="checkbox" name="references_priv" checked="checked" disabled="disabled" id="references_priv" value="SI"/>
									</c:when>
									<c:otherwise>
										<input type="checkbox" name="references_priv" disabled="disabled" id="references_priv" value="SI"/>
									</c:otherwise>
								</c:choose>
							</td>
							<td>
								<label for="references_priv">
									<tt>
										<dfn title="No tiene efecto en esta versión de MySQL.">REFERENCES</dfn>
									</tt>
								</label>
							</td>
						</tr>
						
						<tr>
							<td>
								<c:choose>
									<c:when test="${lista.repl_client_priv=='Y'}">
										<input type="checkbox" name="repl_client_priv" checked="checked" disabled="disabled" id="repl_client_priv" value="SI"/>
									</c:when>
									<c:otherwise>
										<input type="checkbox" name="repl_client_priv" disabled="disabled" id="repl_client_priv" value="SI"/>
									</c:otherwise>
								</c:choose>
							</td>
							<td>
								<label for="repl_client_priv">
									<tt>
										<dfn title="Da el derecho al usuario para preguntar dónde están los esclavos / maestros.">REPLICATION CLIENT</dfn>
									</tt>
								</label>
							</td>
						</tr>
						
						<tr>
							<td>
								<c:choose>
									<c:when test="${lista.repl_slave_priv=='Y'}">
										<input type="checkbox" name="repl_slave_priv" checked="checked" disabled="disabled" id="repl_slave_priv" value="SI"/>
									</c:when>
									<c:otherwise>
										<input type="checkbox" name="repl_slave_priv" disabled="disabled" id="repl_slave_priv" value="SI"/>
									</c:otherwise>
								</c:choose>
							</td>
							<td>
								<label for="repl_slave_priv">
									<tt>
										<dfn title="Necesario para los esclavos de replicación.">REPLICATION SLAVE</dfn>
									</tt>
								</label>
							</td>
						</tr>
						
						<tr>
							<td>
								<c:choose>
									<c:when test="${lista.create_user_priv=='Y'}">
										<input type="checkbox" name="create_user_priv" checked="checked" disabled="disabled" id="create_user_priv" value="SI"/>
									</c:when>
									<c:otherwise>
										<input type="checkbox" name="create_user_priv" disabled="disabled" id="create_user_priv" value="SI"/>
									</c:otherwise>
								</c:choose>
							</td>
							<td>
								<label for="create_user_priv">
									<tt>
										<dfn title="Permite crear, eliminar y cambiar el nombre de las cuentas de usuario.">CREATE USER</dfn>
									</tt>
								</label>
							</td>
						</tr>
						
					</table>
					
				</fieldset>
				
			</fieldset>
			
			<input class="boton" type="button" onclick="window.location='${pageContext.request.contextPath}/jsp/ver-usuarios.jsp'" value="Lista de Usuarios"/>
			<input class="boton" type="button" onclick="window.location='${pageContext.request.contextPath}/jsp/editar-usuario.jsp?usuarioSQL=${lista.user}&amp;hostSQL=${lista.host}'" value="Editar Permisos"/>
		</c:forEach>
			
	</div>

</div>

</body>
</html>
</jsp:root>